//
//  ChooseProductVC.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2021/9/15.
//  Copyright © 2021 zwb. All rights reserved.
//

import UIKit
import EmptyDataSet_Swift
class ZyaChooseProductVC: UIViewController,refreshable,UISearchBarDelegate,UITableViewDelegate,UITableViewDataSource,EmptyDataSetSource,EmptyDataSetDelegate {
    
    lazy var tableView:UITableView = {
        let v = UITableView(frame:CGRect(x: 0, y: 0, width: KSGlobal.screenW, height: self.view.ks_height - 40))
        v.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 100, right: 0)
        v.delegate = self
        v.dataSource = self
        return v
    }()
    var currentMark = 0
    var s_title = ""
    var page = 1
    var s_orgid = ""
    var s_customer_branch_id = ""
    var s_date = ""
    var clientid = ""
   
  
    var markSearchArray = [ZyaFOGoodTModel]()
    
    
    
    var claBgCollectionV:ClaBgCollectionView = {
        var v = ClaBgCollectionView(frame:CGRect(x: 0, y: 40, width: KSGlobal.screenW, height: 40))
        return v
    }()
 
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.addSubview(tableView)
        self.tableView.rowHeight = 44
        self.tableView.register(ZyaChooseProCell.self, forCellReuseIdentifier: ZyaChooseProCell.identifier)
        
        edgesForExtendedLayout = UIRectEdge()
        view.backgroundColor = Theme.awModuleBgColor
        self.tableView.backgroundColor = Theme.awModuleBgColor
         self.tableView.tableFooterView = UIView()
        
      
         
    }
    func network() {
       
        
    }
    
 
    
    func customView(forEmptyDataSet scrollView: UIScrollView) -> UIView? {
        let v = UIImageView(image: UIImage(named: "zanwushuju"))
        v.frame = CGRect(x: 0, y: 0, width: 120, height: 100)
        return v
    }
    func emptyDataSetShouldAllowTouch(_ scrollView: UIScrollView) -> Bool {
        return true
    }
    func emptyDataSetShouldAllowScroll(_ scrollView: UIScrollView) -> Bool {
        return true
    }
    

    func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
        searchBar.resignFirstResponder()
        self.s_title = searchBar.text.unwrap
        self.tableView.mj_header?.beginRefreshing()
    }
    
    
    @objc private func addProduct() {
        
    }
  
    
 
    func setMarkNetwork(id:String,mark:String) {
        KSNetwork.shared.doRequest(API.pFoodSetRecordMark(s_type: "1", s_record_id: id, s_mark: mark),showHud: false) { (data:BaseResult<OperateResult>) in
        }
    }
    // 子类实现
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
           guard let cell = tableView.dequeueReusableCell(withIdentifier: ZyaChooseProCell.identifier, for: indexPath) as? ZyaChooseProCell else {
               fatalError()
           }
 
           return cell
       }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
       
           return 0
   
      
   }
    
}

